Live dangerously with never#41
Live dangerously with never#41treeowl wants to merge 1 commit intomichaelt:masterfrom treeowl:crazy-never
Conversation
Implement `never` by tying a recursive knot and then using `unsafeCoerce`. This gets rid of all its `Effect`s. It's also a bit scary.
|
A more definitely safe way to reduce, but not eliminate, the monadic junk in never = fix $ Step . pure . Step . pure . Step . pure . Step . pure . ... . Effect . returnI'm just a bit worried about building a long chain of pointers to follow, and also about what a CPU's branch predictor will think about this sort of stop-start thing. It might be worth benchmarking. |
|
BTW, I'm not at all sure this is actually a good thing to do. |
|
I can't say I'm particularly in support of this. Seems like clever for clever's sake. If it could at least be verified with a benchmark, I'd be more inclined. |
|
@ocharles I think you're right. But it would be worth thinking about whether the |
Implement
neverby tying a recursive knot and then usingunsafeCoerce. This gets rid of all itsEffects. It's alsoa bit scary.